package com.xbaoziplus.simple_spring.beans.factory.support;

import com.xbaoziplus.simple_spring.core.io.DefaultResourceLoader;
import com.xbaoziplus.simple_spring.core.io.ResourceLoader;

/**
 * @author xbaozi
 * @version 1.0
 * @classname AbstractBeanDefinitionReader
 * @date 2023-05-07  15:00
 * @description 实现 {@link com.xbaoziplus.simple_spring.beans.factory.config.BeanDefinition} 接口前两个方法，并提供了构造函数
 */
public abstract class AbstractBeanDefinitionReader implements BeanDefinitionReader {

    private final BeanDefinitionRegistry registry;

    private ResourceLoader resourceLoader;

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry) {
        this(registry, new DefaultResourceLoader());
    }

    public AbstractBeanDefinitionReader(BeanDefinitionRegistry registry, ResourceLoader resourceLoader) {
        this.registry = registry;
        this.resourceLoader = resourceLoader;
    }

    @Override
    public BeanDefinitionRegistry getRegistry() {
        return registry;
    }

    @Override
    public ResourceLoader getResourceLoader() {
        return resourceLoader;
    }
}
